package cn.fl.bizflow.transform;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.base.bizflow.transform.BaseSysBizFlowRlVOTransform;
import cn.fl.bizflow.vo.SysBizFlowRlVO;
import fl.spl.facade.bizflow.dto.SysBizFlowRlDTO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 业务数据与流程权限关系表 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据
 * @Description: VO转换数据变成DTO传递到服务端
 * @Description: VO不能在服务端出现
 */
public class SysBizFlowRlVOTransform extends BaseSysBizFlowRlVOTransform {

    /**
     * DTO 转  VO
     *
     * @param dto SysBizFlowRlDTO
     * @return SysBizFlowRlVO
     */
    public static SysBizFlowRlVO toVO(SysBizFlowRlDTO dto) {
        SysBizFlowRlVO vo = baseToVO(dto);
        vo.setSysFlowSHDTOList(dto.getSysFlowSHDTOList());
        return vo;
    }

    /**
     * VO 转 DTO
     *
     * @param vo SysBizFlowRlVO
     * @return SysBizFlowRlDTO
     */
    public static SysBizFlowRlDTO toDTO(SysBizFlowRlVO vo) {
        SysBizFlowRlDTO dto = baseToDTO(vo);
        dto.setSysFlowSHDTOList(vo.getSysFlowSHDTOList());
        return dto;
    }

    /**
     * DTO集合 转 VO集合
     *
     * @param list List<SysBizFlowRlDTO>
     * @return List<SysBizFlowRlVO>
     */
    public static List<SysBizFlowRlVO> toVOList(List<SysBizFlowRlDTO> list) {
        List<SysBizFlowRlVO> voList = null;
        if (CollectionUtils.isNotEmpty(list)) {
            voList = new ArrayList<SysBizFlowRlVO>(list.size());
            for (SysBizFlowRlDTO dto : list) {
                voList.add(toVO(dto));
            }
        }
        return voList;
    }

    /**
     * VO集合 转 DTO集合
     *
     * @param list List<SysBizFlowRlVO>
     * @return List<SysBizFlowRlDTO>
     */
    public static List<SysBizFlowRlDTO> toDTOList(List<SysBizFlowRlVO> list) {
        List<SysBizFlowRlDTO> dtoList = null;
        if (CollectionUtils.isNotEmpty(list)) {
            dtoList = new ArrayList<SysBizFlowRlDTO>(list.size());
            for (SysBizFlowRlVO vo : list) {
                dtoList.add(toDTO(vo));
            }
        }
        return dtoList;
    }

}
